namespace SimpleWebServices.Data
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;

    public interface IRepository
    {
        bool Delete(AbsoluteUri urn);

        bool Delete(Token token);

        bool Exists(AbsoluteUri urn);

        bool Exists(Token token);

        bool Exists(string xpath);

        XmlDataObject Export(AbsoluteUri urn);

        XmlDataObject Export(Token token);

        void Insert(IRecord record);

        bool Match(AbsoluteUri urn, string etag);

        bool Match(Token token, string etag);

        bool ModifiedSince(AbsoluteUri urn, DateTime value);

        bool ModifiedSince(Token token, DateTime value);

        IList<T> Query<T>(string xpath)
            where T : IRecord;

        [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Select", Justification = "The naming is intentional.")]
        T Select<T>(AbsoluteUri urn)
            where T : IRecord;

        [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Select", Justification = "The naming is intentional.")]
        T Select<T>(Token token)
            where T : IRecord;

        Token? Token(AbsoluteUri urn);

        bool Update(IRecord record);

        void Upsert(IRecord record);
    }
}